<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<?
session_start();
include("db.php");
if(!isset($_SESSION['login'])){
	echo "<script>window.location='home.php'</script>";
}
else{  
$login=$_SESSION['login'];
$vernome=mssql_query("SELECT memb_name FROM MEMB_INFO Where memb___id='$login'");
$vernome=mssql_result($vernome, 0, 0);
$veremail=mssql_query("SELECT mail_addr FROM MEMB_INFO Where memb___id='$login'");
$veremail=mssql_result($veremail, 0, 0);
$verpergunta=mssql_query("SELECT fpas_ques FROM MEMB_INFO Where memb___id='$login'");
$verpergunta=mssql_result($verpergunta, 0, 0);
$verresposta=mssql_query("SELECT fpas_answ FROM MEMB_INFO Where memb___id='$login'");
$verresposta=mssql_result($verresposta, 0, 0);

if(isset($_POST['nome'])){
$nome=$_POST['nome'];
$pergunta=$_POST['pergunta'];
$resposta=$_POST['resposta'];
$email=$_POST['email'];
$atualizar=mssql_query("UPDATE MEMB_INFO SET
mail_addr='$email' , 
memb_name='$nome' , 
fpas_ques='$pergunta' , 
fpas_answ='$resposta'
Where memb___id='$login'
");
echo "<script>alert('Dados alterados com sucesso!');window.location='manager.php'</script>";
}
}


?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.camposs {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	background-color: #ffffff;
	border: 1px solid #000000;
	color: #FFFFFF;
}
.camposs2 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	background-color: #ffffff;
	border: 1px solid #000000;
}
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #ffffff;
	font-size: 12px;
}
body {
  scrollbar-arrow-color: #FF9900;
  scrollbar-3dlight-color: #FFFFFF;
  scrollbar-highlight-color: #000000;
  scrollbar-face-color: #FFFFFF;
  scrollbar-shadow-color: #000000;
  scrollbar-darkshadow-color: #FFFFFF;
  scrollbar-track-color: #cdcdcd;
	background-color: #000000;
}
.style1 {color: #000000}
-->
</style>
<html>
<head>
<script>
function send(){
	erro='';
	if(document.form1.nome.value==''){ document.form1.nome.value='Indefinido'; }
	if(document.form1.idade.value==''){ document.form1.idade.value='Indefinido'; }
	if(document.form1.sexo.value==''){ document.form1.sexo.value='Indefinido'; }
	if(document.form1.email.value==''){ document.form1.email.value='Indefinido'; }
	if(erro!=''){ alert('Preencha todos os campos!'); }
	else { document.form1.submit() }
}
</script>
</html>
</head>
<body background=images/fundo2.JPG>
<center class="style1">
<form name="form1" method="post" action="">
<table width=300 bordercolor=black border="0" align="center">

  <tr>
    <td colspan=2 align=center><span class="style1"><b>Mudar Meus Dados de Cadastro</b></span></td>
    </tr>


  <tr>
    <td><span class="style1">Nome:</span></td>
    <td><input type="text" size=50 name="nome" value="<? echo $vernome; ?>"></td>
    </tr>
  <tr>
    <td><span class="style1">Pergunta Secreta:</span></td>
    <td><input type="teste" size=50  name="pergunta" value="<? echo $verpergunta; ?>"></td>
    </tr>
  <tr>
    <td><span class="style1">Resposta Secreta:</span></td>
    <td><input type="text" size=50 name="resposta" value="<? echo $verresposta; ?>"></td>
  </tr>
  <tr>
    <td><span class="style1">Email:</span></td>
    <td><input type="teste" size=50 name="email" value="<? echo $veremail; ?>"></td>
  </tr>
  <tr>

    <td colspan=2 align="center">
      <input name="Mudar" type="submit" class="camposs2" id="Mudar" OnClick="send()" value="Enviar Novos Dados">
    </div></td>
    </tr>
</table>
</form>
</center>
